<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}BXC_VideoNet 管理后台{% endblock %}</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
            font-size: 14px;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            background: white;
            border-radius: 15px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            overflow: hidden;
        }

        /* 头部导航 */
        .header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px 25px;
        }

        .header h1 {
            font-size: 24px;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .version-badge {
            background: rgba(255, 255, 255, 0.2);
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: normal;
        }

        .header p {
            opacity: 0.9;
            font-size: 14px;
        }

        .nav {
            display: flex;
            gap: 10px;
            margin-top: 12px;
        }

        .nav-btn {
            background: rgba(255,255,255,0.2);
            color: white;
            border: 2px solid rgba(255,255,255,0.3);
            padding: 6px 15px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s;
            text-decoration: none;
            display: inline-block;
        }

        .nav-btn:hover {
            background: rgba(255,255,255,0.3);
            transform: translateY(-1px);
        }

        .nav-btn.active {
            background: white;
            color: #667eea;
        }

        /* 内容区域 */
        .content {
            padding: 20px;
        }

        /* 卡片样式 */
        .card {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.06);
        }

        .card-title {
            font-size: 17px;
            color: #333;
            margin-bottom: 12px;
            padding-bottom: 8px;
            border-bottom: 2px solid #667eea;
        }

        /* 表单样式 */
        .form-group {
            margin-bottom: 12px;
        }

        .form-label {
            display: block;
            margin-bottom: 5px;
            color: #555;
            font-weight: 600;
            font-size: 14px;
        }

        .form-input, .form-select {
            width: 100%;
            padding: 6px 10px;
            border: 2px solid #e0e0e0;
            border-radius: 6px;
            font-size: 14px;
            transition: all 0.3s;
        }

        .form-input:focus, .form-select:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
        }

        /* 按钮样式 */
        .btn {
            padding: 6px 18px;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s;
            font-weight: 600;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .btn-primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
        }

        .btn-success {
            background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
            color: white;
        }

        .btn-success:hover {
            transform: translateY(-1px);
            box-shadow: 0 3px 10px rgba(86, 171, 47, 0.4);
        }

        .btn-danger {
            background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
            color: white;
        }

        .btn-danger:hover {
            transform: translateY(-1px);
            box-shadow: 0 3px 10px rgba(235, 51, 73, 0.4);
        }

        .btn-secondary {
            background: #6c757d;
            color: white;
        }

        .btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        /* 文件上传 */
        .file-upload {
            border: 2px dashed #667eea;
            border-radius: 8px;
            padding: 12px;
            text-align: center;
            background: rgba(102, 126, 234, 0.05);
            cursor: pointer;
            transition: all 0.3s;
        }

        .file-upload:hover {
            background: rgba(102, 126, 234, 0.1);
            border-color: #764ba2;
        }

        .file-upload-icon {
            font-size: 24px;
            margin-bottom: 6px;
            color: #667eea;
        }

        /* 消息提示 */
        .message {
            padding: 10px 15px;
            border-radius: 6px;
            margin-bottom: 12px;
            display: none;
            font-size: 14px;
        }

        .message.show {
            display: block;
            animation: slideIn 0.3s ease;
        }

        .message-success {
            background: #d4edda;
            color: #155724;
            border-left: 4px solid #28a745;
        }

        .message-error {
            background: #f8d7da;
            color: #721c24;
            border-left: 4px solid #dc3545;
        }

        .message-info {
            background: #d1ecf1;
            color: #0c5460;
            border-left: 4px solid #17a2b8;
        }

        @keyframes slideIn {
            from {
                transform: translateY(-20px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        /* 表格样式 */
        .table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }

        .table th, .table td {
            padding: 6px 10px;
            text-align: left;
            border-bottom: 1px solid #e0e0e0;
            font-size: 14px;
        }

        .table th {
            background: #667eea;
            color: white;
            font-weight: 600;
        }

        .table tr:hover {
            background: #f8f9fa;
        }

        /* 进度条 */
        .progress {
            background: #e0e0e0;
            border-radius: 8px;
            height: 18px;
            overflow: hidden;
            margin-bottom: 10px;
        }

        .progress-bar {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            height: 100%;
            transition: width 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 600;
            font-size: 12px;
        }

        /* 日志输出 */
        .log-box {
            background: #1e1e1e;
            color: #00ff00;
            padding: 12px;
            border-radius: 6px;
            font-family: "Courier New", monospace;
            font-size: 12px;
            max-height: 300px;
            overflow-y: auto;
            line-height: 1.4;
        }

        .log-box::-webkit-scrollbar {
            width: 8px;
        }

        .log-box::-webkit-scrollbar-track {
            background: #2d2d2d;
        }

        .log-box::-webkit-scrollbar-thumb {
            background: #667eea;
            border-radius: 4px;
        }

        /* 网格布局 */
        .grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 12px;
            margin-top: 12px;
        }

        .grid-item {
            background: white;
            padding: 12px;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.08);
        }

        /* 统计卡片 */
        .stat-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 10px;
            border-radius: 8px;
            text-align: center;
        }

        .stat-number {
            font-size: 20px;
            font-weight: bold;
            margin: 4px 0;
        }

        .stat-label {
            font-size: 13px;
            opacity: 0.9;
        }

        /* 响应式 */
        @media (max-width: 768px) {
            .content {
                padding: 20px;
            }
            
            .grid {
                grid-template-columns: 1fr;
            }
            
            .nav {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>
                BXC_VideoNet
                <span class="version-badge">v{{ version }}</span>
            </h1>
            <p>视频分类训练平台 | 作者：北小菜</p>
            <nav class="nav">
                <a href="/" class="nav-btn {% if request.path == '/' %}active{% endif %}">📁 数据集管理</a>
                <a href="/train_page" class="nav-btn {% if request.path == '/train_page' %}active{% endif %}">🚀 模型训练</a>
                <a href="/test_page" class="nav-btn {% if request.path == '/test_page' %}active{% endif %}">🧪 模型测试</a>
                <a href="/convert_page" class="nav-btn {% if request.path == '/convert_page' %}active{% endif %}">🔄 模型转换</a>
            </nav>
        </div>
        <div class="content">
            {% block content %}{% endblock %}
        </div>
    </div>

    <script>
        // 通用消息显示函数
        function showMessage(type, message) {
            const msgDiv = document.createElement('div');
            msgDiv.className = `message message-${type} show`;
            msgDiv.textContent = message;
            
            const content = document.querySelector('.content');
            content.insertBefore(msgDiv, content.firstChild);
            
            setTimeout(() => {
                msgDiv.remove();
            }, 5000);
        }

        // 通用 AJAX 请求函数
        function request(url, options = {}) {
            return fetch(url, {
                headers: {
                    'Content-Type': 'application/json',
                    ...options.headers
                },
                ...options
            })
            .then(response => response.json())
            .catch(error => {
                console.error('请求错误:', error);
                return { success: false, message: '网络请求失败' };
            });
        }
    </script>

    {% block scripts %}{% endblock %}
</body>
</html>
